#define quickread
#ifdef quickread
#include <cstdio> 
template <typename T>
inline void read(T& x)
{
    int c=getchar(), f=1; x=0;
    while(c<'0'||'9'<c) {if(c=='-') f=-1; c=getchar();}
    while('0'<=c&&c<='9') 
        x=(x<<3)+(x<<1)+c-'0', c=getchar();
    x*=f;
}
template <typename T>
inline void quickwrite(T x)
{
    if(x<0) putchar('-'), x*=-1;
    if(x>=10) quickwrite(x/10);
    putchar(x%10+'0');
}
#else 
#include <iostream>
#endif
#include <algorithm>
using namespace std;
#define DEBUG
using ll=long long;
const int N=1e6+10;
int n, q;
ll d[N];

void init()
{
    read(n); read(q);
    for(int i=1; i<=n; i++) read(d[i]);
    sort(d+1, d+1+n);
    for(int i=1; i<=n; i++) d[i]+=d[i-1];
    for(int i=1; i<=n; i++) d[i]+=d[i-1];

}

void solve()
{
    init();
    while(q--)
    {
        ll t=0; read(t);
        int l=0, r=n; //左右区间端点 整体小于等于t
        while(l<r)
        {
            int mid=(l+r+1)>>1;
            // printf("l:%d mid:%d r:%d\n", l, mid, r);
            if(d[mid]>t) r=mid-1;
            else l=mid;
        }
        quickwrite(l); puts("");
    }
}

// #undef DEBUG
signed main()
{
    #ifdef DEBUG
        freopen("../in.txt", "r", stdin);
        // freopen("../out.txt", "w", stdout);
    #endif
    #ifndef quickread
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #endif

    int T=1; //scanf("%d", &T);
    while(T--) 
    {
        solve();
    }
    return 0;
}
